//
//  ICShareBottomView.m
//  ICome
//
//  Created by ENN on 16/8/31.
//  Copyright © 2016年 iCom. All rights reserved.
//

#import "ICShareBottomView.h"
#import "ICShareInstance.h"
#import "ICShareTextView.h"
#import "ICShareImageView.h"
#import "ICShareTextPicView.h"
#import "ICShareFileView.h"
#import "ICHeaderFile.h"

@implementation ICShareBottomView


- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.4];
    }
    return self;
}

- (void)setShareData:(ICShareInstance *)shareData
{
    switch (shareData.shareObject.mediaType) {
        case ICMediaType_Text:
        {
            ICShareTextView *textView = [[ICShareTextView alloc] initWithFrame:CGRectMake(25, 0, App_Frame_Width-50, 310)];
            textView.centerY = self.centerY;
            textView.shareData = shareData;
            [self addSubview:textView];
            break;
        }
        case ICMediaType_Image:
        {
            ICShareImageView *imgView = [[ICShareImageView alloc] initWithFrame:CGRectMake(25, 0, App_Frame_Width-50, 341)];
            imgView.centerY = self.centerY;
            imgView.shareData = shareData;
            [self addSubview:imgView];
            break;
        }
        case ICMediaType_Video:
        {
            break;
        }
        case ICMediaType_File:
        {
            ICShareFileView *textPicV = [[ICShareFileView alloc] initWithFrame:CGRectMake(25, 0, App_Frame_Width-50, 310)];
            textPicV.centerY = self.centerY;
            textPicV.shareData = shareData;
            [self addSubview:textPicV];
            
            break;
        }
        case ICMediaType_PicURL:
        {
            ICShareTextPicView *textPicV = [[ICShareTextPicView alloc] initWithFrame:CGRectMake(25, 0, App_Frame_Width-50, 310)];
            textPicV.centerY = self.centerY;
            textPicV.shareData = shareData;
            [self addSubview:textPicV];
            break;
        }
        default:
            break;
    }
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self endEditing:YES];
}


@end
